#ifndef __SIMPLECHATGAME_H
#define __SIMPLECHATGAME_H

#include "datablock.h"
#include "biglist.h"
#include "chatclient.h"
#include "message.h"
#include "simplechatgameuser.h"

class chatclient;

class simplechatgame:public idisposable
{
	public:
	simplechatgame();
	~simplechatgame();
	biglist<simplechatgameuser *> users; // Users who are using this game.	
	datablock *gameid; // Used for users to tell each other the game id to join the game.
	datablock *gamedata; // Common data for the game such as whose turn it is or where the game pieces are.
	biglist_item<simplechatgameuser *> *add_user(chatclient *client,datastring username); // Adds a user to users. Returns true if successful.
	bool add_client(chatclient *client,datastring username); // Adds a client. Returns true if the client was added.
	void send_message_to_clients(message *message,chatclient *me);
	biglist_item<simplechatgameuser *> *getuser(chatclient *client); // Search user by client.
	biglist_item<simplechatgameuser *> *getuser(datastring username); // Search user by username.
	int usercount(bool withclient); // Returns the number of users. If withclient is true then only count users that are connected.
	void send_user_list_to_clients(); // Sends the list of users to all the clients.
	simplechatgame *clone();
};
#endif